const express = require('express');
const router = express.Router();
const { getUserOrders, getOrderById, getOrderStats, createOrder, updateOrderStatus } = require('../controllers/orderController');
const { authMiddleware } = require('../middleware/authMiddleware');

// 获取用户订单列表
router.get('/', authMiddleware, getUserOrders);

// 获取订单统计数据
router.get('/stats', authMiddleware, getOrderStats);

// 获取订单详情
router.get('/:id', authMiddleware, getOrderById);

// 创建订单
router.post('/', authMiddleware, createOrder);

// 更新订单状态
router.put('/:id/status', authMiddleware, updateOrderStatus);

module.exports = router;